<template>
	<view>
		<view class="search">
			<u-search :showAction="true" @search="search" @custom="search" v-model="queryParams.params.title" placeholder="请输入标题"></u-search>
		</view>
				
		<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMore">
			
			<view class="cu-list menu-avatar">
				<view class="cu-item cur" v-for="(item, index) in list" :key="index" @click="navTo(item.url, item.id)">
					<view class="cu-avatar radius lg" style="background-image:url(../../../static/imgs/message.png); background-color: #fff;">
						<view class="cu-tag badge"></view>
					</view>
					<view class="content">
						<view>
							<view class="text-cut">{{item.title}}</view>
						</view>
						<view class="text-gray text-sm flex">
							<view class="text-cut">{{item.content}}</view>
						</view>	
					</view>
					<view class="action">
						<view class="text-grey text-xs">{{item.createTime}}</view>
					</view>
				</view>												
			</view>
			
			<!-- 加载更多 -->
			<u-loadmore :status="loadStatus" marginTop="20" marginBottom="20" @loadmore="loadMore" />
			
		</scroll-view>
		
	</view>
</template>
<script>
import { listMixin } from "@/mixins/list"	

export default {
	mixins: [ listMixin ],
	data() {
		return {
			//查询参数
			queryParams: {
			  //第几页
			  pageNum: 1,
			  //一页几行
			  pageSize: 10,
			  //条件
			  params: {
				  status: "0",
				  auditby: null,
				  title: ""
			  }
			}
		};
	},
	onShow() {
		this.queryParams.params.auditby = this.userInfo.userId;
		this.search();
	},
	methods: {
		//调用list接口
		callList(queryParams) {
			let _this = this;
			return new Promise(function(resolve, reject) {
				_this.$u.api.flowTodo.list(queryParams).then((res) => {
					let inum = res.total.toString();
					// 设置底部导航栏角标
					uni.setTabBarBadge({
					  index: 1,
					  text: inum
					});				
					resolve(res);
				}).catch((error) => {
					reject(error)
				});			
			});  
		},
		navTo(url, id) {
			uni.navigateTo({
				url: "/pages/" + url + "?id=" + id
			});
		}
	}
};

</script>
<style lang="scss">
	@import '@/static/scss/system/msg/index.scss';
</style>
